#ifndef INPUTHANDLER_H
#define INPUTHANDLER_H

#include <QJsonObject>
#include <functional>


class InputHandler

{
public:
    static InputHandler& getInstance();

    void registerCallback(const std::string & command, std::function<void (QJsonObject&, QJsonObject&)> func);

    std::function<void (QJsonObject&, QJsonObject&)> operator[](const std::string& args);

    std::function<void (QJsonObject&, QJsonObject&)> get(const std::string& args);

    // 删除拷贝构造函数和拷贝赋值操作符
    InputHandler(InputHandler const&) = delete;
    InputHandler& operator=(InputHandler const&) = delete;
private:
    InputHandler() = default;

    std::map<std::string, std::function<void (QJsonObject&, QJsonObject&)>>routerMap;
};

#endif // INPUTHANDLER_H
